﻿package vklib 
{
	import vklib.emulator.*;
	/**
	 * ...
	 * @author apisoc@gmail.com
	 */
	internal class VkWrapper implements IVkWrapper
	{
		private var _impl:Object;
		
		public function VkWrapper(impl:Object) 
		{
			_impl = impl;
			if (null == _impl || !('external' in _impl)) {
				if (!_impl || null == _impl.stage) throw new Error('Fatal: stage not defined!');
				VkConfig.loadConfig(_impl.stage.loaderInfo);
				_impl = { application: VkApplication.getInstance(impl.stage)
					, external: VkExternal.getInstance()
					, lang: VkLang.getInstance() }
			}
		}
		
		public function get application():* { _impl.application; }
		public function get external():* { return _impl.external; }
		public function get lang():* { return _impl.lang; }

		public function get parameters():Object { return _impl.application.parameters; }

		public function get maxWidth():uint { return application.stageWidth; }
		public function get maxHeight():uint { return application.stageHeight; }
		
		public function get width():uint { return 666; }
		//public function get width():uint { return application.stageHeight; }
	}

}